import 'package:flutter_ahj_app/base/basewidget/model/BaseModel.dart';
import 'package:rxdart/subjects.dart';
import 'package:flutter_ahj_app/app/HttpRequest.dart';

class PTXYModel extends BaseModel {
  BehaviorSubject _getAppAgreementSub;
  Stream get getAppAgreementStream => _getAppAgreementSub.stream;

  getAppAgreement({String type}) {
    _getAppAgreementSub = BehaviorSubject();
    HttpRequest.getAppAgreement(type: type).listen((event) {

      print(event);
      _getAppAgreementSub.add(event);
    }, onError: (e) {
      errorData.add(e);
    });
  }

  @override
  void dispose() { 
    if (_getAppAgreementSub != null) {
      _getAppAgreementSub.close();
    }
    super.dispose();
  }
}
